import hcQuest.HCQ;
import hcQuest.HCQ_Interface;

import java.net.URL;

import javax.swing.JApplet;

public class HCQ_Applet extends JApplet implements HCQ_Interface {
    /**
     * short online version without direct SQL (only php mode) --> take out
     * inc/sql.ini and referenced jar files are not need.
     */
    private static final long serialVersionUID = 1L;
    private HCQ hcqPanel;

    @Override
    public void init() {
	final String lang = getParameter("lang");
	final String exp = getParameter("experiment");
	final String askSubID = getParameter("askSubjectID");
	boolean askID = false;
	if (askSubID != null && askSubID.equals("true")) {
	    askID = true;
	}

	hcqPanel = new HCQ(false, this, this.getClass(), lang, exp, askID);
	setSize(hcqPanel.getSize());
	add(hcqPanel);
	setVisible(true);
    }

    public void quitApplication() {
	setVisible(false);
	try {
	    URL u = new URL(getCodeBase(), "end.html");
	    /** translate */
	    getAppletContext().showDocument(u);
	} catch (Exception e) {
	    destroy();
	}

    }
}
